package com.ciccwm.log.config;

import com.ciccwm.log.aspect.LogPrintAspect;
import com.ciccwm.log.handler.DefaultLogHandler;
import com.ciccwm.log.handler.LogHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * 日志自动配置类
 */
@Configuration
@EnableAspectJAutoProxy
public class LogAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public LogHandler logHandler() {
        return new DefaultLogHandler();
    }

    @Bean
    public LogPrintAspect logPrintAspect(LogHandler logHandler) {
        return new LogPrintAspect(logHandler);
    }
} 